<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>RRT: C:/Users/Stefan/Documents/Atmel Studio/RobotikSeminar/RRT/include/USART.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">RRT
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">USART.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;avr/io.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="utilities_8h_source.html">Utilities.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="error_8h_source.html">error.h</a>&quot;</code><br/>
</div>
<p><a href="_u_s_a_r_t_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structmsg___u_s_a_r_t__t.html">msg_USART_t</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a9d3f0beef953108963142b557774f885"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9d3f0beef953108963142b557774f885"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>F_CPU2</b>&#160;&#160;&#160;20000000</td></tr>
<tr class="separator:a9d3f0beef953108963142b557774f885"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a734bbab06e1a9fd2e5522db0221ff6e3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a734bbab06e1a9fd2e5522db0221ff6e3"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>BAUDRATE</b>&#160;&#160;&#160;1200</td></tr>
<tr class="separator:a734bbab06e1a9fd2e5522db0221ff6e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ab2b795ba261b113b8113d1fd52459132"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#ab2b795ba261b113b8113d1fd52459132">msg_type_USART_t</a> { <b>ACK</b>, 
<b>SYNC</b>, 
<b>DATA</b>
 }</td></tr>
<tr class="separator:ab2b795ba261b113b8113d1fd52459132"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab94fbb73b86fff26278a1372bea9833c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#ab94fbb73b86fff26278a1372bea9833c">init_USART</a> ()</td></tr>
<tr class="separator:ab94fbb73b86fff26278a1372bea9833c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b13c81c6030a58c6c2d0ead00025957"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#a4b13c81c6030a58c6c2d0ead00025957">send_byte_USART</a> (uint8_t *byte)</td></tr>
<tr class="separator:a4b13c81c6030a58c6c2d0ead00025957"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a320cb46f566a2d93e969881fc547f6bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#a320cb46f566a2d93e969881fc547f6bb">send_msg_USART</a> (<a class="el" href="structmsg___u_s_a_r_t__t.html">msg_USART_t</a> *msg)</td></tr>
<tr class="separator:a320cb46f566a2d93e969881fc547f6bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a50bb4ca20536062f3522b21d0b73a305"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#a50bb4ca20536062f3522b21d0b73a305">receive_byte_USART</a> (uint8_t *byte)</td></tr>
<tr class="separator:a50bb4ca20536062f3522b21d0b73a305"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9f79410be8cd0f4ddabc71ffd35c86f1"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="_u_s_a_r_t_8h.html#a9f79410be8cd0f4ddabc71ffd35c86f1">receive_msg_USART</a> (<a class="el" href="structmsg___u_s_a_r_t__t.html">msg_USART_t</a> *msg)</td></tr>
<tr class="separator:a9f79410be8cd0f4ddabc71ffd35c86f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ab2b795ba261b113b8113d1fd52459132"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="_u_s_a_r_t_8h.html#ab2b795ba261b113b8113d1fd52459132">msg_type_USART_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This enum is representing the different message types, which are used by the protocol for communicating by USART </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ab94fbb73b86fff26278a1372bea9833c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void init_USART </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Initializes the USART controller for future use. The frame format defined for USART communication consists of eight data bits, a parity bit (even) and two stop bits </p>

</div>
</div>
<a class="anchor" id="a50bb4ca20536062f3522b21d0b73a305"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t receive_byte_USART </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>byte</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function blocks until a byte can be received from the USART controller </p>
<dl class="section return"><dt>Returns</dt><dd>Returns 0 at success. Otherwise errno will be set to one of these values: <br/>
 FRAME_ERROR_USART if a frame error occurred; <br/>
 PARITY_ERROR_USART if a parity error occurred; <br/>
 OVERFLOW_USART if an overflow occurred </dd></dl>

</div>
</div>
<a class="anchor" id="a9f79410be8cd0f4ddabc71ffd35c86f1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t receive_msg_USART </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmsg___u_s_a_r_t__t.html">msg_USART_t</a> *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>The user is responsible to free the memory of the data field of the returned message. </p>
<dl class="section return"><dt>Returns</dt><dd>Returns 0 at success. Otherwise errno will be set to one of these values:<br/>
 FRAME_ERROR_USART if a frame error occurred; <br/>
 PARITY_ERROR_USART if a parity error occurred; <br/>
 OVERFLOW_USART if an overflow occurred </dd></dl>

</div>
</div>
<a class="anchor" id="a4b13c81c6030a58c6c2d0ead00025957"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void send_byte_USART </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>byte</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Transmits a single byte by using USART </p>

</div>
</div>
<a class="anchor" id="a320cb46f566a2d93e969881fc547f6bb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void send_msg_USART </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structmsg___u_s_a_r_t__t.html">msg_USART_t</a> *&#160;</td>
          <td class="paramname"><em>msg</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Transmits the given message by using USART </p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 21 2012 11:14:18 for RRT by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.2
</small></address>
</body>
</html>
